/**
 * jims
 */
package com.jims.api.v1.controller.emr;

import com.jims.master.common.data.Message;
import com.jims.master.common.data.StringData;
import com.jims.master.common.persistence.Page;
import com.jims.master.common.utils.SecurityUtil;
import com.jims.master.common.utils.StringUtils;
import com.jims.master.common.web.BaseController;

import com.jims.master.modules.emr.entity.CourseRecord;
import com.jims.master.modules.emr.entity.ElectronIndexDisease;
import com.jims.master.modules.emr.entity.ZhuyuanBasicInfo;
import com.jims.master.modules.emr.service.CourseRecordService;
import com.jims.master.modules.emr.service.ZhuyuanBasicInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

/**
 * Controller
 * @author WangYongQiang
 * @version 2018-08-16
 */
@Controller
@RequestMapping(value = "/courseRecord")
public class CourseRecordController extends BaseController {

	@Autowired
	private CourseRecordService courseRecordService;
	@Autowired
	private ZhuyuanBasicInfoService zhuyuanBasicInfoService;
	/**
	 * @Title: findUserV100
	 * @Description: （通过住院id查询病程记录）
	 * @param
	 * @return java.lang.String
	 * @author WangYQ
	 * @date 2018-08-16
	 * @throws
	 */
	@RequestMapping(value = "V100/getCourseRecordByVisitId",method ={RequestMethod.GET,RequestMethod.POST})
	@ResponseBody
	public String getCourseRecordByVisitId(@RequestParam(required=false) String visitId) {
		Message msg=new Message();
		ZhuyuanBasicInfo zhuyuanBasicInfo = zhuyuanBasicInfoService.findByVisitId(visitId);
		List<CourseRecord> list = new ArrayList<CourseRecord>();
		if(zhuyuanBasicInfo!=null){
			list=courseRecordService.getCourseRecordByZhuYuanId(zhuyuanBasicInfo.getId());
			msg.setData(list);
		}
		return SecurityUtil.encryptMsgData(msg);
	}

}